package q;

import extlib.Pair;

public class RxR {

    private final Pair<R, R> rxr;

    private RxR(Pair<R, R> rxr) {
        this.rxr = rxr;
    }

    public R y() {
        return rxr.y();
    }

    public R x() {
        return rxr.x();
    }

    public Integer x1() {
        return x().x();
    }

    public Integer y1() {
        return x().y();
    }

    public Integer x2() {
        return y().x();
    }

    public Integer y2() {
        return y().y();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final RxR other = (RxR) obj;
        if (this.rxr != other.rxr && (this.rxr == null || !this.rxr.equals(other.rxr))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 61 * hash + (this.rxr != null ? this.rxr.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "(" + x() + "," + y() + ")";
    }

    public static RxR RxR(R x, R y) {
        return new RxR(Pair.pair(x, y));
    }
}
